package lab03.test14;

import java.sql.*;

/**
 * Created by 123 on 2017/12/11.
 */
public class Test14 {
    public static void main(String[] args) {
        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;

  //     String sqlinsert = "insert into t_userinfo(usercode,username,password,email)" +
   //            "values('7101','宋小美','123456','123456@qq.com') ";
        String sqlinsert1 = "insert into t_userinfo(usercode,username,password,email)" +
                "values('7102','宋小宝','1234456','125696@qq.com') ";
        String sqlselect="select *from t_userinfo";

        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/java_2017?serverTimezone=UTC",
                    "root",
                    "123456");
            statement = connection.createStatement();
        //    statement.execute(sqlinsert);
            statement.execute(sqlinsert1);
//
//            resultSet=statement.executeQuery(sqlselect);
////            while (resultSet.next()){
////                String usercode=resultSet.getString(1);
////                String username=resultSet.getString(2);
////                String password=resultSet.getString(3);
////                String email=resultSet.getString(4);
////                System.out.println("usercode"+usercode+"username"+username+"password"+password+"email"+email);
////            }


        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
